
import java.text.DecimalFormat;

public class Account 
{
	private int iD;
	private Customer1 customer1;
	private double balance;
	
	public Account(int iD,Customer1 customer1, double balance) 
	{
		this.iD = iD;
		this.customer1 = customer1;
		this.balance = balance;
	}

	public Account(int iD, Customer1 customer1) 
	{
		this.iD = iD;
		this.customer1 = customer1;
	}

	public double getBalance() {
		return balance;
	}

	public void setBalance(double balance) {
		this.balance = balance;
	}

	public int getiD() {
		return iD;
	}

	public Customer1 getCustomer1() {
		return customer1;
	}
	public String toString()
	{
		DecimalFormat df = new DecimalFormat("#.00");
		return "name("+iD+") balance="+"$"+df.format(balance);
	}
	public String getCustomer1Name()
	{
		return customer1.getName();
	}
	public Account deposit(double amount)
	{
		balance+=amount);
		return this;
	}
	public Account withdraw(double amount)
	{
		if(balance>=amount)
		{
			balance = balance-amount;
			return this;
		}else
			System.out.println("amount withdrawn exceeds the current balance");
		    return this;
	}

}
